from fastapi import Header
from starlette import status

from src import settings
from src.enum.exception import ExceptionEnum
from src.exception import ResponseException

async def verify_token(token: str = Header(...)):
    if token != settings.API_TOKEN:
        raise ResponseException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            error= ExceptionEnum.INVALID_TOKEN
        )
    return token
